/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.peng.commdit.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author pengjinaye
* @date 2021-10-08
**/
@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@Table(name="commodity_manage")
public class CommodityManage implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "product_name")
    @ApiModelProperty(value = "商品名称")
    private String productName;

    @Column(name = "specifi")
    @ApiModelProperty(value = "商品规格")
    private String specifi;

    @Column(name = "produconver")
    @ApiModelProperty(value = "商品封面")
    private String produconver;

    @Column(name = "commcarousel")
    @ApiModelProperty(value = "商品轮播图")
    private String commcarousel;

    @Column(name = "categories")
    @ApiModelProperty(value = "商品分类")
    private String categories;

    @Column(name = "produdetails")
    @ApiModelProperty(value = "商品详情")
    private String produdetails;

    @Column(name = "status")
    @ApiModelProperty(value = "商品状态")
    private String status;

    @Column(name = "price")
    @ApiModelProperty(value = "商品价格")
    private Double price;

    @Column(name = "freigh")
    @ApiModelProperty(value = "运费")
    private String freigh;

    @Column(name = "insock")
    @ApiModelProperty(value = "库存")
    private Integer insock;

    @Column(name = "pints_redeem")
    @ApiModelProperty(value = "所需兑换积分")
    private Integer pintsRedeem;

    @Column(name = "details_map")
    @ApiModelProperty(value = "商品详情图")
    private String detailsMap;

    @Column(name = "product_sold")
    @ApiModelProperty(value = "商品已售")
    private Integer productSold;

    public void copy(CommodityManage source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
